package com.neusoft.util;

import java.io.IOException;
import java.io.InputStream;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

public class SSFactoryImpl implements SSFactory {
	
	public SqlSessionFactory getSqlSessionFactory() {
	// 创建SqlSessionFactoryBuilder对象
	SqlSessionFactoryBuilder builder = new SqlSessionFactoryBuilder();
	System.out.println("zhe1");
	// 查找配置文件创建输入流
	InputStream config = null;
	try {
		config = Resources.getResourceAsStream("SqlMapConfig.xml");
	} catch (IOException e) {
		e.printStackTrace();
	}
	System.out.println("zhe2");
	// 加载配置文件，创建SqlSessionFactory对象
	SqlSessionFactory factory = builder.build(config);
	System.out.println(factory);
	
	return factory;
	
	}
}
